package com.sali.controller.sysuser;


import com.sali.application.sysuser.model.vo.SysUserDetailVO;
import com.sali.application.sysuser.model.vo.SysUserVO;
import com.sali.application.sysuser.service.impl.SystemUserService;
import com.sali.commons.BaseController;
import com.sali.commons.annotation.AccessIpLimiter;
import com.sali.commons.annotation.ApiLog;
import com.sali.commons.annotation.LoginIgnore;
import com.sali.utils.result.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @description:
 * @author: sali
 * @date: 2024/7/20 10:19.
 * @version: 1.0
 */
@RestController
@Slf4j
public class UserController extends BaseController {

    @Resource
    private SystemUserService systemUserService;


    @GetMapping("/user/get/{id}")
    @LoginIgnore
    @AccessIpLimiter
    @ApiLog("获取用户id")
    public SysUserDetailVO getUserById(@PathVariable("id") Long id) {
        return systemUserService.selectById(id);
    }

    @GetMapping("/user/account/{account}")
    public R<SysUserVO> getUserByAccount(@PathVariable("account") String account) {
        return  R.success( systemUserService.selectSysUserByAccount(account) );
    }

}
